<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		div {
			width: 500px;
			height: 200px;
			border: 2px solid black;
			
		}
		div img {
			width: 100%;
			height: 100%;

		}
	</style>
</head>
<body>
	<div id="demo"></div>
	<script>
		var oImg = new Image();
		oImg.src = 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1538549052804&di=d3db4471b1f9f69f2f5dfad6be063874&imgtype=0&src=http%3A%2F%2Fimg.chuansong.me%2Fmmbiz_jpg%2FmXjFQ4ibKEbzSnL6QGWhMQAeianBDx6EMYicLVz7TRnMb0UFflrZJKiaSWeGR34AHhTibSmKZWAanqnRgIUNL17XtAg%2F0%3Fwx_fmt%3Djpeg';
		var oDiv = document.getElementById('demo');
		oImg.onload = function () {//等图片加载完，在插入到div里
			oDiv.appendChild(oImg);
		}
	</script>
</body>
</html>